<?php
namespace app\common\model;

use think\Model;

class StudentModel extends Model
{
    protected $autoWriteTimestamp = true;

    const tableName = 'student';

    public function getCreateTimeAttr($value)
    {
         return date("Y-m-d H:i:s", $value);
    }

    public function getStatusTextAttr($value, $data)
    {
         if ($data['status'] == 0) {
            return '<span style="color: #FF5722">无效</span>';
         } else {
            return '<span style="color: #5FB878">有效</span>';
         }
    }

    public static function getMagicTableName()
    {
          return '__'.strtoupper(self::tableName).'__';
    }

}